package com.sccomsumer.comsumer.controller;

import com.sccomsumer.comsumer.service.UserCommonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * 使用Feign进行远程服务调用。
 */
@RestController
@RequestMapping("/user")
public class OpenFeignController {
    @Autowired
    private UserCommonService commonService;

    @GetMapping("/isAlive2")
    public String getAPI() {
        return commonService.isAlive();
    }

    @GetMapping("/sayHi")
    public String getHi() {
        return commonService.getHi(125);
    }

    @GetMapping("/sayHiByName")
    public String getHiByName() {
        return commonService.getHi2(125, "小亮");
    }

    @GetMapping("/getMap")
    public Map<Integer,String> getMap(@RequestParam Map<String, Object> map){
		map.put("id", map.get("id"));
		map.put("name", map.get("name"));
        return commonService.getMap3(map);
    }
}
